<?php
    
    class TemplateHelpers
    {
  
        public function OutputTo($uri)
        {
            $parts = explode('/', $uri);
            $url = core::$config['root'] . 'output.php?module='.$parts[0] . (isset($parts[1])?'&action='.$parts[1]:null).(ADMIN?'&admin':null);
            return $url;  
        }
        
        public function hrefTo($uri)
        {
            $url = $this->config['root'] . $uri;
            return $url;  
        }
        
        public function getHrefTo($uri)
        {
             
        }
        
        public function getCss()
        {
            $output ='';
            
            foreach(core::$config['css'] as $css )
            {
                $output .= '<link rel="stylesheet" type="text/css" href="'.core::$config['root'] . core::$config[ 'tpl_dir' ] . '/' . core::$config[ 'tpl_standard' ] .'/css/'.$css.'"/>';
            }
            
            return $output;
        }
        
        public function setCss($css)
        {
           if(is_array($css))
           {
             foreach($css as $item)
             {
                core::$config['css'][] = $item;    
             }  
           } 
           else
           {
              core::$config['css'][] = $css; 
           }
        }
        
        public function setJs($js)
        {
           if(is_array($js))
           {
             foreach($js as $item)
             {
                core::$config['js'][] = $item;    
             }  
           } 
           else
           {
              core::$config['js'][] = $js; 
           } 
        }
        
        public function getjs()
        {
           $return ='';
            foreach(core::$config['js'] AS $item)
            {
                $return .= '<script type="text/javascript" src="'.core::$config['root'].'js/'.$item.'"></script>  ';
            }
           return $return;
        }
        
        public function getRank($id)
        {
            switch($id) {
             case(0):
                return 'Iedereen';
             case(1):
                return 'Deelnemer';
             case(2):
                return 'Poule leider';
             case(3):
                return 'Admin';
            }
                
        }
        
    }
?>
